home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 #2 / Ham Radio 2000 - Volume 2.iso / HAMV2 / TCP_IP / TNOS230S / FORTH.H < prev    next >
Encoding:
C/C++ Source or Header  |  1996-12-28  |  1.4 KB  |  71 lines

  1. #ifdef FORTH
  2. #ifndef FORTH_WORD
  3.  
  4. struct vocentry {
  5.     char type;
  6. #define FORTH_WORD    0
  7. #define FORTH_VARIABLE    1
  8. #define FORTH_CONSTANT    2
  9.     char length;
  10.     char name[9];
  11. };
  12.  
  13. /* variable and constant types */
  14. #define FORTH_NORMAL        1
  15. #define FORTH_SYSTEM        2
  16. #define FORTH_READONLY        4
  17. #define FORTH_INDIRECT        8
  18.  
  19. /* word types */
  20. #define FORTH_END        0
  21. #define FORTH_LOCALENTRY    1
  22. #define FORTH_FIXEDENTRY    2
  23. #define FORTH_INT32        3
  24. #define FORTH_RETSTACK        4
  25. #define FORTH_ARGUMENT        5
  26.  
  27. struct fvars {
  28.     char const *name;
  29.     char type;
  30.     char options;
  31.     int32 value;
  32. };
  33.  
  34. struct fcompiler {        /* compiler scratch space */
  35.     char buf[512];
  36.     char base;
  37.     char arg;
  38.     char first;
  39.     char *p;
  40.     struct vocentry v;
  41. };
  42.  
  43. struct forth {
  44.     struct mbuf *vocabulary;
  45.     struct mbuf *stack;
  46.     struct mbuf *retstack;
  47.     struct mbuf *pad;
  48.     char *word;
  49.     char args;
  50.     char final;
  51.     char delimiter;        /* used by the parser, default is a space */
  52.     int32 base;
  53.     int (*nextfkn) (struct forth * task);
  54.     struct fcompiler *fc;
  55.     int goaddr;        /* goto pointer, changes the flow of a compiled word */
  56.     FILE *fp;
  57.     int s;
  58. };
  59.  
  60. struct wordlist {
  61.     const char *name;
  62.     int (*fkn) (struct forth * task);
  63.     char args;        /* number of arguments, if negative. Otherwise
  64.                delimiting character for the next argument. */
  65. };
  66.  
  67. int doforth (int argc, char *argv[], void *p);
  68.  
  69. #endif /* FORTH_WORD */
  70. #endif /* FORTH */
  71.